﻿@{
    ViewBag.Title = "Administrar Iglesias";
}

<br />
<div id="IglesiaTable"></div>

@section Scripts {
    <script type="text/javascript">
        $(document).ready(function () {
            $('#IglesiaTable').jtable({
                title: '@ViewBag.Title',
                paging: true,
                pageSize: 25,
                sorting: true,
                multiSorting: true,
                defaultSorting: 'nombre ASC',
                actions: {
                    listAction: '@Url.Action("IglesiaList","Catalogo")',
                    deleteAction: '@Url.Action("DeleteIglesia","Catalogo")',
                    updateAction: '@Url.Action("UpdateIglesia","Catalogo")',
                    createAction: '@Url.Action("CreateIglesia","Catalogo")'
                },
                fields: {
                    idIglesia: {
                        key: true,
                        create: false,
                        edit: false,
                        list: false
                    },
                    nombre: {
                        title: 'Nombre',
                        inputClass: 'validate[required,maxSize[45]]'
                    },
                    pastor: {
                        title: 'Pastor',
                        inputClass: 'validate[maxSize[45]]'
                    },
                    idPais: {
                        title: 'Pais',
                        inputClass: 'validate[required]',
                        options: '@Url.Action("GetPaisOptions","Catalogo")'
                    }
                },
                formCreated: function (event, data) {
                    data.form.validationEngine();
                },
                formSubmitting: function (event, data) {
                    return data.form.validationEngine('validate');
                },
                formClosed: function (event, data) {
                    data.form.validationEngine('hide');
                    data.form.validationEngine('detach');
                }
            });

            $('#IglesiaTable').jtable('load');
        });
    </script>
}
